package com.atguigu.springboot.mapper;

import com.atguigu.springboot.bean.Department;
import org.apache.ibatis.annotations.*;

/**
 * @author : leimingchao
 * @date Date : 2021年10月17日 10:58
 */

/**
 * 指定这是一个操作数据库的mapper
 */
// @Mapper
public interface DepartmentMapper {

    @Select(value = "select * from department where id = #{id}")
    Department getDepartmentById(Integer id);

    @Delete(value = "delete from department where id = #{id}")
    int deleteDepartmentById(Integer id);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert(value = "insert into department(department_name) values(#{departmentName})")
    int insertDepartment(Department department);

    @Update(value = "update department set department_name = #{departmentName} where id = #{id}")
    int updateDepartment(Department department);
}
